package canchaFulbito.servletacceso;

import java.io.IOException;
import java.util.Collection;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import canchaFulbito.excepcion.DAOExcepcion;
import canchaFulbito.modelo.Cancha;
import canchaFulbito.negocio.SeguridadNegocio;

/**
 * Servlet implementation class BuscarCanchas
 */
@WebServlet("/BuscarCanchas")
public class BuscarCanchasServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BuscarCanchasServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 /*
		try{
		     SeguridadNegocio n = new SeguridadNegocio();	 
			 
			 String cmbDia         = request.getParameter("selectDia");
			 String cmbHora1       = request.getParameter("selectHInicio");
			 String cmbHora2       = request.getParameter("selectHFin");
			 String cmbcodDistrito = request.getParameter("selectDistrito");
			 
			 /*System.out.println("cmbDia -> " + cmbDia + "\n");
			 System.out.println("cmbHora1 ->" + cmbHora1+ "\n");
			 System.out.println("cmbHora1 ->" + cmbHora2+ "\n");
			 System.out.println("cmbHora1 ->" + cmbcodDistrito+ "\n");
			 
		    //BUSCAR este Funciona
			
			 cmbDia="Lunes";
			 cmbHora1="6";
			 cmbHora2="24";
			 cmbcodDistrito="4";
			 
			 Collection<Cancha> lcancha = n.ListarCanchas(cmbDia, cmbHora1, cmbHora2, cmbcodDistrito);

								
	     	if (lcancha.size()>0)
	     	{
			//SI SE ENCUENTRA CONCORDANCIA SE MUESTRA
		     	request.setAttribute("Canchas", lcancha);
			    }
		    else
			//SI NO SE ENCUENTRA MUESTRA MENSAJE
			{ System.out.println("No se ha encontrado la Cancha con los filtros"); 
			};
		} 
		catch (DAOExcepcion e) 
		{
		   //Assert.fail("Fallo: " + e.getMessage());
		}
	
		RequestDispatcher rd = request.getRequestDispatcher("BuscarCancha.jsp");
		rd.forward(request, response);
	}
*/
	}
}
